轻量级站点统计代码
感谢番茄提供的代码。
1 | <li id= "text-5" class = "widget widget_text" ><h2 class = "widgettitle" >站点统计</h2> |
2 | <div class = "textwidget" ></div> |
3 | <div class = "widget" > |
4 | <ul> |
5 | <li>建站时间:2012年06月09日</li> |
6 | <li>网站运行:<?php echo floor ((time()- strtotime ( "2012-06-09" ))/86400); ?>天</li> |
7 | <li>文章总数:<?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts ->publish;?></li> |
8 | <li>分类总数:<?php echo $count_categories = wp_count_terms( 'category' ); ?>个</li> |
9 | <li>评论总数:<?php echo $wpdb ->get_var( "SELECT COUNT(*) FROM $wpdb->comments" );?></li> |
10 | <li>最后更新:<?php $last = $wpdb ->get_results( "SELECT MAX(post_modified) AS MAX_m FROM $wpdb->posts WHERE (post_type = 'post' OR post_type = 'page') AND (post_status = 'publish' OR post_status = 'private')" ); $last = date ( 'Y-n-j' , strtotime ( $last [0]->MAX_m)); echo $last ; ?></li> |
11 | </ul> |
12 | </div> |
13 | </li> |
这个统计准不准啊?
估计精度不高!!!
精度?难道你要算到毫秒级?
这个不错